package com.ly.count.impl.user.transfer;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ly.count.login.param.CPlusRegisterParam;
import com.ly.count.login.po.CPlusLogin;
import com.ly.count.room.param.CPlusRoomUserPage;
import com.ly.count.room.po.CPlusRoomUser;
import com.ly.count.user.param.CPlusUserPage;
import com.ly.count.user.po.CPlusUser;

import java.sql.Timestamp;

public class CPlusUserTransfer {
    public static Page<CPlusUser> toPage(CPlusUserPage cPlusUserPage) {
        Page<CPlusUser> page = new Page<>();
        page.setTotal(cPlusUserPage.getTotal());
        page.setCurrent(cPlusUserPage.getCurrent());
        page.setSize(cPlusUserPage.getSize());

        return page;
    }

    public static CPlusUser toPO(CPlusRegisterParam cPlusRegisterParam) {
        if (cPlusRegisterParam == null) {
            return null;
        }
        CPlusUser cPlusUser = new CPlusUser();
        cPlusUser.setUserName(cPlusRegisterParam.getAccount());
        cPlusUser.setMobilephone(cPlusRegisterParam.getPhone());
        cPlusUser.setNickname(cPlusRegisterParam.getNickName());
        cPlusUser.setCreateTime(new Timestamp(System.currentTimeMillis()));
        cPlusUser.setCreator(0L);
        return cPlusUser;
    }
}
